/**
 * 版权所有(C)，上海海鼎信息工程股份有限公司，2007，所有权利保留。
 * 
 * 项目名：	rumba
 * 文件名：	PromptContent.java
 * 模块说明：	
 * 修改历史：
 * Nov 6, 2007 - lxm - 创建。
 */
package com.hd123.rumba.prompt.provider;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.hd123.rumba.exception.BusinessException;
import com.hd123.rumba.util.ObjectUtil;

/**
 * 提醒内容 | 实现类
 * 
 * @author lxm
 * 
 */
public class PromptContent extends HashMap<String, Object> implements IPromptContent {

  public void applyParams(Map<String, Object> dict) throws BusinessException {
    throw BusinessException.neverCallMe();
  }

  public String toContext() throws BusinessException {
    throw BusinessException.neverCallMe();
  }

  public void merge(IPromptContent source) {
    for (String key : source.keySet()) {
      Object value = source.get(key);
      if (value != null)
        this.put(key, value);
    }
  }

  public boolean sameAs(IPromptContent target) throws BusinessException {
    return ObjectUtil.equals(this.getTitle(), target.getTitle())
        && ObjectUtil.equals(this.getText(), target.getText())
        && ObjectUtil.equals(this.getFlag(), target.getFlag())
        && ObjectUtil.equals(this.getLevel(), target.getLevel())
//        && ObjectUtil.equals(this.getSenderId(), target.getSenderId())
        && ObjectUtil.equals(this.getSenderClassName(), target.getSenderClassName())
        && ObjectUtil.equals(this.getTime(), target.getTime());
  }

  public String getTitle() {
    return (String) this.get("title");
  }

  public void setTitle(String title) {
    if (title == null)
      this.remove("title");
    else
      this.put("title", title);
  }

  public String getText() {
    return (String) this.get("text");
  }

  public void setText(String text) {
    if (text == null)
      this.remove("text");
    else
      this.put("text", text);
  }

  public String getFlag() {
    return (String) this.get("flag");
  }

  public void setFlag(String flag) {
    if (flag == null)
      this.remove("flag");
    else
      this.put("flag", flag);
  }

  public Integer getLevel() {
    return (Integer) this.get("level");
  }

  public void setLevel(Integer level) {
    if (level == null)
      this.remove("level");
    else
      this.put("level", level);
  }

  public String getSenderId() {
    return (String) this.get("senderId");
  }

  public void setSenderId(String senderId) {
    if (senderId == null)
      this.remove("senderId");
    else
      this.put("senderId", senderId);
  }

  public String getSenderClassName() {
    return (String) this.get("senderClassName");
  }

  public void setSenderClassName(String senderClassName) {
    if (senderClassName == null)
      this.remove("senderClassName");
    else
      this.put("senderClassName", senderClassName);
  }

  public Date getTime() {
    return (Date) this.get("time");
  }

  public void setTime(Date time) {
    if (time == null)
      this.remove("time");
    else
      this.put("time", time);
  }
}
